
import "./rewrite";
import { App } from 'vue';
import "@/types/index.d.ts";
import fui from './fui-config';
import useAudio from './audio';
import tools from '@/utils/index';
import store from '@/stores/index';
import request from './https/install';
import { imgPath, baseUrl } from './config';

/** 添加 uni 或 组件属性和方法 */
export default {
	install: (app: App) => {
		/** 小程序端需同步修改 @/uni_modules/z-paging/components/z-paging/config/index.js */
		uni['$zp'] = {
			config: {
				fixed: false,
				'created-reload': true,
				'loading-full-fixed': true,
				'hide-no-more-inside': true,
				'auto-hide-loading-after-first-loaded': false,
				'empty-view-img': "https://online-edu-test.mfy777.com/img/svg/empty.svg",
				'empty-view-error-img': 'https://dwzx.dingwei.cn/applet/default/network.svg'
			}
		};
		
		
		/** 接口服务器地址 */
		uni.baseUrl = baseUrl;
		
		/** 接口服务器地址 */
		app.config.globalProperties.baseUrl = baseUrl;
		
		
		/** 存储图片的服务器地址 */
		uni.imageBaseUrl = imgPath;
		
		/** 存储图片的服务器地址 */
		app.config.globalProperties.imageBaseUrl = imgPath;
		
		
		/** 仓库 */
		uni.$store = store;
		
		/** 仓库 */
		app.config.globalProperties.$store = store;
		
		
		/** $fui 属性方法 */
		uni.$fui = fui;
		
		/** $fui 属性方法 */
		app.config.globalProperties.$fui = fui;
		
		
		/** 请求 */
		uni.$http = request();
		
		/** 请求 */
		app.config.globalProperties.$http = request();
		
		
		/** audio */
		uni.useAudio = useAudio();

		/** audio */
		app.config.globalProperties.useAudio = useAudio();
		
		
		/** 获取节点 */
		uni.getRect = tools.getRect;
		
		/** 获取节点 */
		app.config.globalProperties.getRect = tools.getRect as typeof uni.getRect;
		
		
		/** 格式化手机号码 */
		app.config.globalProperties.numberFormatter = tools.numberFormatter;
	}
};
